<?php
/*********************************************************************************
 * SugarCRM is a customer relationship management program developed by
 * SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
 * 
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Affero General Public License version 3 as published by the
 * Free Software Foundation with the addition of the following permission added
 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
 * details.
 * 
 * You should have received a copy of the GNU Affero General Public License along with
 * this program; if not, see http://www.gnu.org/licenses or write to the Free
 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301 USA.
 * 
 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
 * 
 * The interactive user interfaces in modified source and object code versions
 * of this program must display Appropriate Legal Notices, as required under
 * Section 5 of the GNU Affero General Public License version 3.
 * 
 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
 * these Appropriate Legal Notices must retain the display of the "Powered by
 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
 * technical reasons, the Appropriate Legal Notices must display the words
 * "Powered by SugarCRM".
 ********************************************************************************/
$dictionary['edanz_Flags'] = array(
	'table'=>'edanz_flags',
	'audited'=>true,
	'fields'=>array (
		'deliverable_id' => array (
			'name' => 'deliverable_id',
			'vname'=>'LBL_DELIVERABLE_ID',
			'rname' => 'id',
			'type' => 'id',
			'dbType'=>'id',
			'table' => 'edanz_deliverables',
			'isnull' => 'true',
			'module' => 'edanz_Deliverables',
			'massupdate' => true,
			'duplicate_merge'=> 'disabled',
			'audited' => true,
		),
		'deliverable_name' => array (
			'name' => 'deliverable_name',
			'link'=>'deliverable_link' ,
			'vname' => 'LBL_DELIVERABLE',
			'rname' => 'name',
			'type' => 'relate',
			'reportable'=>false,
			'source'=>'non-db',
			'table' => 'edanz_deliverables',
			'id_name' => 'deliverable_id',
			'module'=>'edanz_Deliverables',
			'duplicate_merge'=>'disabled',
			'required' => true,
		),
		'deliverable_link' => array (
			'name' => 'deliverable_link',
			'type' => 'link',
			'relationship' => 'edanz_deliverables_edanz_flags',
			'vname' => 'LBL_DELIVERABLE',
			'link_type' => 'one',
			'module'=>'edanz_Deliverables',
			'bean_name'=>'edanz_Deliverable',
			'source'=>'non-db',
			'duplicate_merge'=>'enabled',
			'rname' => 'name',
			'id_name' => 'deliverable_id',
			'table' => 'edanz_deliverables',
		),
		'security_group' => 
			  array (
			    'name' => 'security_group',
			    'vname' => 'LBL_SECURITY_GROUP',
			    'type' => 'enum',
			  	'source' => 'non-db',
			    'options'=>'security_group_list',
			  ),
		'relate_deliverable_name' => 
		  array (
		    'name' => 'relate_deliverable_name',
		    'vname' => 'LBL_RELATE_DELIVERABLE_NAME	',
		    'type' => 'varchar',
		    'required' => false,
		    'importable' => 'required',
		    'massupdate' => 0,
		    'comments' => '',
		    'help' => '',
		    'duplicate_merge' => 'enabled',
		    'duplicate_merge_dom_value' => '1',
		    'audited' => true,
		    'reportable' => true,
		    'size' => '20',
		    'source' => 'non-db',
		  ),
		 'relate_job_name' => 
		  array (
		    'name' => 'relate_job_name',
		    'vname' => 'LBL_RELATE_JOB_NAME',
		    'type' => 'varchar',
		    'unified_search' => true,
		    'required' => false,
		    'importable' => 'required',
		    'massupdate' => 0,
		    'comments' => '',
		    'help' => '',
		    'duplicate_merge' => 'enabled',
		    'duplicate_merge_dom_value' => '1',
		    'audited' => true,
		    'reportable' => true,
		    'size' => '20',
		    'source' => 'non-db',
		  ),
		   'relate_job_id' => 
		  array (
		    'name' => 'relate_job_id',
		    'vname' => 'LBL_RELATE_JOB_ID',
		    'type' => 'id',
		    'source' => 'non-db',
		  ),
/*		'task_id' => array (
			'name' => 'task_id',
			'vname'=>'LBL_TASK_ID',
			'rname' => 'id',
			'type' => 'id',
			'dbType'=>'id',
			'table' => 'tasks',
			'isnull' => 'true',
			'module' => 'Tasks',
			'massupdate' => true,
			'duplicate_merge'=> 'disabled',
			'audited' => true,
		),
		'task_name' => array (
			'name' => 'task_name',
			'link'=>'task_link' ,
			'vname' => 'LBL_TASK',
			'rname' => 'name',
			'type' => 'relate',
			'reportable'=>false,
			'source'=>'non-db',
			'table' => 'tasks',
			'id_name' => 'Task_id',
			'module'=>'Tasks',
			'duplicate_merge'=>'disabled',
		),
		'task_link' => array (
			'name' => 'task_link',
			'type' => 'link',
			'relationship' => 'flag_task',
			'vname' => 'LBL_TASK',
			'link_type' => 'one',
			'module'=>'Tasks',
			'bean_name'=>'Task',
			'source'=>'non-db',
			'duplicate_merge'=>'enabled',
			'rname' => 'name',
			'id_name' => 'task_id',
			'table' => 'tasks',
		),
*/
	),
	'relationships'=>array (
//		'flag_deliverable' => array(
//			'lhs_module'=> 'edanz_Deliverables',
//			'lhs_table'=> 'edanz_deliverables',
//			'lhs_key' => 'id',
//			'rhs_module'=> 'edanz_Flags' ,
//			'rhs_table'=> 'edanz_flags',
//			'rhs_key' => 'deliverable_id',
//			'relationship_type'=>'many-to-many'
//		),
/*	   'flag_task' => array(
			'lhs_module'=> 'Tasks',
			'lhs_table'=> 'tasks',
			'lhs_key' => 'id',
			'rhs_module'=> 'edanz_Flags' ,
			'rhs_table'=> 'edanz_flags',
			'rhs_key' => 'task_id',
			'relationship_type'=>'one-to-many'
		),
*/
	),
	'optimistic_locking'=>true,
);
// Security Suite Groups
global $beanList;
if (isset($beanList['SecurityGroups'])) {
	$dictionary["edanz_Flags"]["fields"]["securitygroups_edanz_flags"] = array (
	  'name' => 'securitygroups_edanz_flags',
	  'type' => 'link',
	  'relationship' => 'securitygroups_edanz_flags',
	  'source' => 'non-db',
	  'vname' => 'LBL_SECURITYGROUPS_SUBPANEL_TITLE',
	);
	$dictionary["edanz_Flags"]["relationships"]["securitygroups_edanz_flags"] = array (
		'lhs_module' => 'SecurityGroups',
		'lhs_table' => 'securitygroups',
		'lhs_key' => 'id',
		'rhs_module' => 'edanz_Flags',
		'rhs_table' => 'edanz_flags',
		'rhs_key' => 'id',
		'join_table' => 'securitygroups_records',
		'join_key_lhs' => 'securitygroup_id',
		'join_key_rhs' => 'record_id',
		'relationship_type' => 'many-to-many',
		'relationship_role_column' => 'module',
		'relationship_role_column_value' => 'edanz_Flags',
	);
}

$dictionary["edanz_Flags"]["fields"]["edanz_deliverables_edanz_flags"] = array (
	  'name' => 'edanz_deliverables_edanz_flags',
	  'type' => 'link',
	  'relationship' => 'edanz_deliverables_edanz_flags',
	  'source' => 'non-db',
	  'vname' => 'LBL_FLAG_SUBPANEL_TITLE',
	);
if (!class_exists('VardefManager')){
        require_once('include/SugarObjects/VardefManager.php');
}
VardefManager::createVardef('edanz_Flags','edanz_Flags', array('basic'));

$dictionary['edanz_Flags']['fields']['name']['type'] = 'enum';
$dictionary['edanz_Flags']['fields']['name']['options'] = 'flag_types';
$dictionary['edanz_Flags']['fields']['name']['audited'] = true;
$dictionary['edanz_Flags']['fields']['description']['audited'] = true;